package com.deyuanyun.pic.pipe.controller.vo;

import com.deyuanyun.pic.common.util.DateUtil;
import com.deyuanyun.pic.common.util.ObjectUtil;
import com.deyuanyun.pic.common.util.format.DateFormat;
import com.deyuanyun.pic.common.util.format.NumberFormat;
import com.deyuanyun.pic.pipe.domain.SteelPipe;
import com.deyuanyun.pic.pipe.domain.TransformMedia;
import com.deyuanyun.pic.settings.support.biz.CodeUtil;
import com.deyuanyun.pic.settings.support.biz.PipeLineUtil;
import com.github.pagehelper.Page;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * 钢管信息表
 */
public class SteelPipeVO extends BaseVO<SteelPipe> {

    // 管道ID
    private String pipeLineName;
    // 钢管编号(自定义编号)
    private String pipeNumber;
    // 出厂编号(自定义编号)
    private String manufacturedNum;
    // 管材
    private String material;
    // 钢管类型
    private String pipeType;
    // 制管焊缝类型
    private String manupipeseamType;
    // 上游环焊缝焊接编号
    private String ugwwId;
    // 下游环焊缝焊接编号
    private String dgwwId;
    // 炉批号
    private String stoveserialNum;
    // 管径（mm）
    private String diameter;
    // 壁厚（mm）
    private String wallThickness;
    // 管节长度（m）
    private String pipeLength;
    // 防腐层材料
    private String coatingMaterial;
    // 防腐层安装地点
    private String coatingSource;
    // 内外防腐
    private String interNalorexternal;
    // 防腐层厚度（mm）
    private String coatingThickness;
    // 检漏电压(KV)
    private String testVoltage;
    // 钢管生产厂商
    private String pipeManufacturer;
    // 钢管生产日期
    private String pipeManufactureDate;
    // 防腐层制造厂商
    private String coatingManufacturer;
    // 防腐层制造日期
    private String coatingManufactureDate;

    public String getPipeLineName() {
        return pipeLineName;
    }

    public void setPipeLineName(String pipeLineName) {
        this.pipeLineName = pipeLineName;
    }

    public String getPipeNumber() {
        return pipeNumber;
    }

    public void setPipeNumber(String pipeNumber) {
        this.pipeNumber = pipeNumber;
    }

    public String getManufacturedNum() {
        return manufacturedNum;
    }

    public void setManufacturedNum(String manufacturedNum) {
        this.manufacturedNum = manufacturedNum;
    }

    public String getMaterial() {
        return material;
    }

    public void setMaterial(String material) {
        this.material = material;
    }

    public String getPipeType() {
        return pipeType;
    }

    public void setPipeType(String pipeType) {
        this.pipeType = pipeType;
    }

    public String getManupipeseamType() {
        return manupipeseamType;
    }

    public void setManupipeseamType(String manupipeseamType) {
        this.manupipeseamType = manupipeseamType;
    }

    public String getUgwwId() {
        return ugwwId;
    }

    public void setUgwwId(String ugwwId) {
        this.ugwwId = ugwwId;
    }

    public String getDgwwId() {
        return dgwwId;
    }

    public void setDgwwId(String dgwwId) {
        this.dgwwId = dgwwId;
    }

    public String getStoveserialNum() {
        return stoveserialNum;
    }

    public void setStoveserialNum(String stoveserialNum) {
        this.stoveserialNum = stoveserialNum;
    }

    public String getDiameter() {
        return diameter;
    }

    public void setDiameter(String diameter) {
        this.diameter = diameter;
    }

    public String getWallThickness() {
        return wallThickness;
    }

    public void setWallThickness(String wallThickness) {
        this.wallThickness = wallThickness;
    }

    public String getPipeLength() {
        return pipeLength;
    }

    public void setPipeLength(String pipeLength) {
        this.pipeLength = pipeLength;
    }

    public String getCoatingMaterial() {
        return coatingMaterial;
    }

    public void setCoatingMaterial(String coatingMaterial) {
        this.coatingMaterial = coatingMaterial;
    }

    public String getCoatingSource() {
        return coatingSource;
    }

    public void setCoatingSource(String coatingSource) {
        this.coatingSource = coatingSource;
    }

    public String getInterNalorexternal() {
        return interNalorexternal;
    }

    public void setInterNalorexternal(String interNalorexternal) {
        this.interNalorexternal = interNalorexternal;
    }

    public String getCoatingThickness() {
        return coatingThickness;
    }

    public void setCoatingThickness(String coatingThickness) {
        this.coatingThickness = coatingThickness;
    }

    public String getTestVoltage() {
        return testVoltage;
    }

    public void setTestVoltage(String testVoltage) {
        this.testVoltage = testVoltage;
    }

    public String getPipeManufacturer() {
        return pipeManufacturer;
    }

    public void setPipeManufacturer(String pipeManufacturer) {
        this.pipeManufacturer = pipeManufacturer;
    }

    public String getPipeManufactureDate() {
        return pipeManufactureDate;
    }

    public void setPipeManufactureDate(String pipeManufactureDate) {
        this.pipeManufactureDate = pipeManufactureDate;
    }

    public String getCoatingManufacturer() {
        return coatingManufacturer;
    }

    public void setCoatingManufacturer(String coatingManufacturer) {
        this.coatingManufacturer = coatingManufacturer;
    }

    public String getCoatingManufactureDate() {
        return coatingManufactureDate;
    }

    public void setCoatingManufactureDate(String coatingManufactureDate) {
        this.coatingManufactureDate = coatingManufactureDate;
    }

    public void fromDomain(SteelPipe domain) {

        if (ObjectUtil.isEmptyAll(domain)) {
            return;
        }
        // 管道名称
        this.pipeLineName = PipeLineUtil.getPipeLineName(domain.getPipeLineId());
        // 钢管编号
        this.pipeNumber = domain.getPipeNumber();
        // 出厂编号
        this.manufacturedNum = domain.getManufacturedNum();
        // 管材
        this.material = CodeUtil.getName(domain.getMaterial());
        // 钢管类型
        this.pipeType = CodeUtil.getName(domain.getPipeType());
        // 制管焊缝类型
        this.manupipeseamType = CodeUtil.getName(domain.getManupipeseamType());
        // 上游环焊缝焊接编号
        this.ugwwId = domain.getUgwwId();
        // 下游环焊缝焊接编号
        this.dgwwId = domain.getDgwwId();
        // 炉批号
        this.stoveserialNum = domain.getStoveserialNum();
        // 管径（mm）
        this.diameter = CodeUtil.getName(domain.getDiameter());
        // 壁厚（mm）
        this.wallThickness = NumberFormat.format(domain.getWallThickness());
        // 管节长度（m）
        this.pipeLength = NumberFormat.format(domain.getPipeLength(), NumberFormat.FMT_PLACES3);
        // 防腐层材料
        this.coatingMaterial = CodeUtil.getName(domain.getCoatingMaterial());
        // 防腐层安装地点
        this.coatingSource = CodeUtil.getName(domain.getCoatingSource());
        // 内外防腐
        this.interNalorexternal = CodeUtil.getName(domain.getInterNalorexternal());
        // 防腐层厚度（mm）
        this.coatingThickness = NumberFormat.format(domain.getCoatingThickness());
        // 检漏电压(KV)
        this.testVoltage = NumberFormat.format(domain.getTestVoltage());
        // 钢管生产厂商
        this.pipeManufacturer = domain.getPipeManufacturer();
        // 钢管生产日期
        this.pipeManufactureDate = DateFormat.format(domain.getPipeManufactureDate());
        // 防腐层制造厂商
        this.coatingManufacturer = domain.getCoatingManufacturer();
        // 防腐层制造日期
        this.coatingManufactureDate = DateFormat.format(domain.getCoatingManufactureDate());

        super.fromDomain(domain.getId(), domain.getRecorder(), domain.getRecordtime(), domain.getCreateRemark());
    }

    public Page<SteelPipeVO> fromDomainList(Page<SteelPipe> domainList) {
        Page<SteelPipeVO> list = new Page<SteelPipeVO>();
        for (SteelPipe steelPipe : domainList) {
            SteelPipeVO steelPipeVO = new SteelPipeVO();
            steelPipeVO.fromDomain(steelPipe);
            list.add(steelPipeVO);
        }
        BaseVOUtil.converterPage(domainList, list);
        return list;
    }
}